Telegram Group & Telegram Channel
OpenCV и веб-камера

Для работы с компьютерным зрением и картинками/видео существует библиотека OpenCV.

Устанавливается она через PIP:
pip install opencv-python.

Для простой демонстрации попробуем получить картинку с веб-камеры и вывести видео в графическое окно.

Команда cap = cv2.VideoCapture(0) инициализирует веб-камеру (цифра указывает её индекс).

Строчка ret, frame = cap.read() вытягивает из веб-камеры картинку в переменную frame и статус получения картинки в ret. Если ret == True, значит все прошло успешно.

Команда cv2.imshow('webcam', frame) создаст графическое окно с картинкой и покажет его.

Чтобы прервать работу скрипта используется проверка на нажатие определенной клавиши на клавиатуре:
if cv2.waitKey(1) & 0xFF == ord('q'):

Метод cap.release() освобождает веб-камеру из скрипта примера и позволяет ее использовать в других программах, а cv2.destroyAllWindows() уничтожит графические окна, созданные библиотекой openCV.

#opencv



tg-me.com/python_academy/759
Create:
Last Update:

OpenCV и веб-камера

Для работы с компьютерным зрением и картинками/видео существует библиотека OpenCV.

Устанавливается она через PIP:
pip install opencv-python.

Для простой демонстрации попробуем получить картинку с веб-камеры и вывести видео в графическое окно.

Команда cap = cv2.VideoCapture(0) инициализирует веб-камеру (цифра указывает её индекс).

Строчка ret, frame = cap.read() вытягивает из веб-камеры картинку в переменную frame и статус получения картинки в ret. Если ret == True, значит все прошло успешно.

Команда cv2.imshow('webcam', frame) создаст графическое окно с картинкой и покажет его.

Чтобы прервать работу скрипта используется проверка на нажатие определенной клавиши на клавиатуре:
if cv2.waitKey(1) & 0xFF == ord('q'):

Метод cap.release() освобождает веб-камеру из скрипта примера и позволяет ее использовать в других программах, а cv2.destroyAllWindows() уничтожит графические окна, созданные библиотекой openCV.

#opencv

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/759

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

NEWS: Telegram supports Facetime video calls NOW!

Secure video calling is in high demand. As an alternative to Zoom, many people are using end-to-end encrypted apps such as WhatsApp, FaceTime or Signal to speak to friends and family face-to-face since coronavirus lockdowns started to take place across the world. There’s another option—secure communications app Telegram just added video calling to its feature set, available on both iOS and Android. The new feature is also super secure—like Signal and WhatsApp and unlike Zoom (yet), video calls will be end-to-end encrypted.

Export WhatsApp stickers to Telegram on iPhone

You can’t. What you can do, though, is use WhatsApp’s and Telegram’s web platforms to transfer stickers. It’s easy, but might take a while.Open WhatsApp in your browser, find a sticker you like in a chat, and right-click on it to save it as an image. The file won’t be a picture, though—it’s a webpage and will have a .webp extension. Don’t be scared, this is the way. Repeat this step to save as many stickers as you want.Then, open Telegram in your browser and go into your Saved messages chat. Just as you’d share a file with a friend, click the Share file button on the bottom left of the chat window (it looks like a dog-eared paper), and select the .webp files you downloaded. Click Open and you’ll see your stickers in your Saved messages chat. This is now your sticker depository. To use them, forward them as you would a message from one chat to the other: by clicking or long-pressing on the sticker, and then choosing Forward.

Python Academy from id


Telegram Python Academy
FROM USA